<?php
header("Content-type: text/html; charset=utf-8");
//数据连接
$link = mysqli_connect('localhost','root','','my_database');
if (!$link) {
    exit("数据库连接错误：".mysqli_connect_error());
    }
if(!mysqli_set_charset($link,'utf8')){
    exit("数据库字符集错误".mysqli_error($link));
}
//echo "链接成功！";
?>